]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
misc/objectManager: Fix emission of object-removed signal
authorJonas Dreßler <verdre@v0yd.nl>
Mon, 3 Apr 2023 14:12:59 +0000 (16:12 +0200)
committerMarge Bot <marge-bot@gnome.org>
Wed, 5 Apr 2023 18:43:51 +0000 (18:43 +0000)
Emitting this signal is broken right now: We check for a length of 0 on
this._objects[objectPath], but the
`this._objects[objectPath][interfaceName] = null` we do before the
check doesn't actually remove the key, it only sets the value to null,
leaving the key around and thus the amount of entries in the object doesn't
change.

Fix that by using the delete statement instead, "delete" properly removes
the key and thus affects the amount of entries in the object, making our
length === 0 check effective.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2730>

js/misc/objectManager.js

index c40975988a9058e89feb75ac44d2f0aed793ae10..a1dcde3a7b4183ec474d1008a78103b79432ec20 100644 (file)
@@ -130,7 +130,7 @@ var ObjectManager = class extends Signals.EventEmitter {
 
         this.emit('interface-removed', interfaceName, proxy);
 
-        this._objects[objectPath][interfaceName] = null;
+        delete this._objects[objectPath][interfaceName];
 
         if (Object.keys(this._objects[objectPath]).length === 0) {
             delete this._objects[objectPath];